package com.scm.dto.resp.invent;

import com.scm.dto.resp.product.ScmProductDo;
import com.scm.persist.model.ScmInventoryStashProduct;
import lombok.Data;

@Data
public class ScmInventoryStashProductDo {

    private Long id;

    private Long tenantId;

    private Long stashId;

    private String stashName;

    private Long productId;

    private String productCode;

    private String productName;

    private Integer productCount;

    private String productUnit;

    private String productSpec;

    private String inStashAmount;

    private String outStashAmount;

    private String remark;

    private Long createTime;

    private String createUser;

    private Long updateTime;

    private String updateUser;

    private Integer productLockCount;

    private Integer versions;

    private Integer availableCount;

    public Integer getAvailableCount(){

        if(productLockCount==null||productCount==null){
            return productCount;
        }else{
            return productCount-productLockCount;
        }
    }

    public void setScmInventoryStashProduct(ScmInventoryStashProduct scmInventoryStashProduct, ScmProductDo scmProductDo ){
        this.setId(scmInventoryStashProduct.getId());
        this.setTenantId(scmInventoryStashProduct.getTenantId());
        this.setStashId(scmInventoryStashProduct.getStashId());
        this.setStashName(scmInventoryStashProduct.getStashName());
        this.setProductId(scmInventoryStashProduct.getProductId());
        this.setProductCode(scmProductDo.getProductCode());
        this.setProductName(scmProductDo.getProductName());
        this.setProductCount(scmInventoryStashProduct.getProductCount());
        this.setProductUnit(scmProductDo.getProductUnit());
//        this.setInStashAmount(scmInventoryStashProduct.getInStashAmount());
//        this.setOutStashAmount(scmInventoryStashProduct.getOutStashAmount());
        this.setRemark(scmInventoryStashProduct.getRemark());
        this.setProductLockCount(scmInventoryStashProduct.getProductLockCount());
    }


}
